<!--
 @description 自定义页面楼层内容项
 @fileName ContentItem.vue
 @author zengqiongying
 @created 2022/12/28 15:10:00
-->
<template>
  <div
    class="floor-item"
    :class="{'show-three-clo':column===3,'show-four-scroll':isScroll}"
  >
    <div class="item-content" @click="clickHandle">
      <div class="imgbox">
        <div class="image">
          <ImageVideo lazy-load :host="host" :src="src" fit="fill" />
        </div>
      </div>
      <div class="name">{{ name }}</div>
    </div>
  </div>
</template>

<script>
import ImageVideo from '@/components/ImageVideo'
export default {
  name: 'CustomPageContentItem',
  components: {
    ImageVideo
  },
  props: {
    src: {
      type: String,
      default: ''
    },
    name: {
      type: String,
      default: ''
    },
    column: {
      type: Number,
      default: 4
    },
    isScroll: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      host: process.env.VUE_APP_STATIC
    }
  },
  created() {},
  activated() {},

  mounted() {},

  methods: {
    clickHandle() {
      this.$emit('click')
    }
  }
}

</script>
<style lang='less' scoped>
.floor-item{
  width:25%;
  padding: 0 5px 10px;
  margin-top: 12px;
  box-sizing: border-box;
  .item-content{
    border-radius: 9px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .imgbox{
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    overflow: hidden;
  }
  .image{
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    border-radius: 9px;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
  &.show-three-clo{
    width: 33.3333%;
  }
  &.show-four-scroll{
    flex-shrink: 0;
    width: 103px !important;
    margin-top: 0;
  }
  .name{
    margin-top: 8px;
    // padding: 0 10px;
    width: 100%;
    line-height: 1;
    font-weight: 400;
    font-size: 12px;
    color: #333333;
    box-sizing: border-box;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp:2;
    overflow: hidden;
    text-align:center;
  }
}
</style>
